package com.greatwall.hip.cms.service.impl;

import com.greatwall.hip.cms.entity.LyMzYblxmx;
import com.greatwall.hip.cms.dao.LyMzYblxmxDao;
import com.greatwall.hip.cms.model.Req;
import com.greatwall.hip.cms.service.LyMzYblxmxService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 门诊医保类型明细表(LyMzYblxmx)表服务实现类
 *
 * @author makejava
 * @since 2021-07-05 16:33:08
 */
@Service("lyMzYblxmxService")
public class LyMzYblxmxServiceImpl implements LyMzYblxmxService {
    @Resource
    private LyMzYblxmxDao lyMzYblxmxDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public LyMzYblxmx queryById(Long id) {
        return this.lyMzYblxmxDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LyMzYblxmx> queryAllByLimit(int offset, int limit) {
        return this.lyMzYblxmxDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param lyMzYblxmx 实例对象
     * @return 实例对象
     */
    @Override
    public LyMzYblxmx insert(LyMzYblxmx lyMzYblxmx) {
        this.lyMzYblxmxDao.insert(lyMzYblxmx);
        return lyMzYblxmx;
    }

    /**
     * 修改数据
     *
     * @param lyMzYblxmx 实例对象
     * @return 实例对象
     */
    @Override
    public LyMzYblxmx update(LyMzYblxmx lyMzYblxmx) {
        this.lyMzYblxmxDao.update(lyMzYblxmx);
        return this.queryById(lyMzYblxmx.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.lyMzYblxmxDao.deleteById(id) > 0;
    }

    @Override
    public List<LyMzYblxmx> selectInsurancePatientTrend(Req req) {
        return lyMzYblxmxDao.selectInsurancePatientTrend(req);
    }

    @Override
    public List<LyMzYblxmx> selectInsuranceAmount(Req req) {
        return lyMzYblxmxDao.selectInsuranceAmount(req);
    }
}
